/**
 * 
 */
package com.ljkj.zjf.common;

import java.util.Random;

public class Randoms {
	private Randoms() {
	}

	private static Randoms instance = null;

	private static final Random RANDOM = new Random();
	public static final char codes[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'G', 'K', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
			'i', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '2', '3', '4', '5', '6', '7', '8', '9' }; // �ַ�����,ȥ��������ֵ����ֺ���ĸ
	public static final char nums[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };// ��������

	public static synchronized Randoms getInstance() {
		if (instance == null) {
			instance = new Randoms();
		}
		return instance;
	}

	/**
	 * ��ȡָ��λ����������
	 * 
	 * @param count
	 *                λ��
	 * @return
	 * @author dingqipeng 2014-6-24
	 */
	public String getNum(int count) {
		char[] result = new char[count];
		for (int i = 0; i < count; i++) {
			result[i] = nums[RANDOM.nextInt(nums.length)];
		}
		return new String(result);
	}

	public static void main(String[] args) {
		System.out.println(Randoms.getInstance().getNum(1000));
	}
}
